package com.forum.module.blog.dal.dataobject.category;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.forum.framework.mybatis.core.dataobject.BaseDO;

import java.util.Objects;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/2 18:05
 */
@TableName(value = "blog_category", autoResultMap = true)
public class CategoryDO extends BaseDO {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 排序值（数值越小排序越靠前）
     */
    private Long sort;

    public CategoryDO() {
    }

    public CategoryDO(Long id, String name, Long sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    public Long getId() {
        return id;
    }

    public CategoryDO setId(Long id) {
        this.id = id;
        return this;
    }

    public String getName() {
        return name;
    }

    public CategoryDO setName(String name) {
        this.name = name;
        return this;
    }

    public Long getSort() {
        return sort;
    }

    public CategoryDO setSort(Long sort) {
        this.sort = sort;
        return this;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        CategoryDO that = (CategoryDO) object;
        return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(sort, that.sort);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, sort);
    }
}
